
function lexCacheUpdates(data) {
	// Ignore if data is not an array.
	if (!$.isArray(data)) {
		alert("DEBUG: What's wrong? lexCacheUpdates received non-array.");
		return;
	}
	
	// Iterate through data to check for uid in each item.
	$.each(data, function(index, item) {
		if (item == undefined || !("uid" in item)) {
			// Discard unrecognizable item.
			// TODO Display warning about server.
			continue;
		}
		// Check whether server says that item was deleted.
		if (item["deleted"]) {
			// TODO Remove from cache and update UI.
			continue;
		}
		// Cache the given item.
		lexicon[item.uid] = item;
		// Update UI to reflect latest version of item.
		lexViewUpdates(item.uid);
		// Don't call lexShowing because already have latest version.
	});
}

function lexNewNode() {}
function lexNewChild(parent) {}
function lexNewField(node) {}
function lexNewRelation(node) {}
function lexAddParents(node, parents) {}
function lexRemoveParents(node, parents) {}

function serverExit(save) {
	$.post("exit", {"save": save});
	// TODO update UI
}
